var mongoose = require('mongoose')

var Schema = mongoose.Schema

mongoose.connect('mongodb://localhost/student')

var studentSchema = new Schema({
    name: {
        type: String,
        required: true
    },
    gender: {
        type: Number,
        enum: [0, 1],
        default: 0
    },
    age: {
        type: Number

    },
    hobbies: {
        type: String
    }
})

module.exports = mongoose.model('Commont', studentSchema)

// var admin = new user({
//     name: "赵六",
//     gender: 0,
//     age: 18,
//     hobbies: "读书，打球"
// })

// admin.save(function(err) {
//     if (err) {
//         console.log("保存失败")
//     } else {
//         console.log("保存成功")
//     }
// })